<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <form id="my-form" class="am-form tpl-form-line-form" method="post">
                    <div class="widget-body">
                        <fieldset>
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">微信支付设置</div>
                            </div>
                            <input type="hidden" name="data[wx][is_sub]" value="0">
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label">商户全称</label>
                                <div class="am-u-sm-9">
                                    <input type="text" class="tpl-form-input" name="data[wx][name]"
                                    value="{$model['wx']['name']}">
                                    <small>开启分账支付模式（交易流水提佣）时必填，为商户号的主体全称</small>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label form-require">
                                    微信应用 <span class="tpl-form-line-small-title">APP_ID</span>
                                </label>
                                <div class="am-u-sm-9">
                                    <input type="text" class="tpl-form-input" name="data[wx][app_id]"
                                    value="{$model['wx']['app_id']}" required>
                                    <small>可设置为助手小程序的APPID，但必须建立与下列商户号的支付关系</small>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label form-require">
                                    商户号 <span class="tpl-form-line-small-title">MCH_ID</span>
                                </label>
                                <div class="am-u-sm-9">
                                    <input type="text" class="tpl-form-input" name="data[wx][mch_id]"
									value="{$model['wx']['mch_id']}" required>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label form-require">
                                    支付密钥 <span class="tpl-form-line-small-title">API_KEY</span>
                                </label>
                                <div class="am-u-sm-9">
                                    <input type="text" class="tpl-form-input" name="data[wx][api_key]"
									value="{$model['wx']['api_key']}" required>
                                </div>
                            </div>
							<div class="am-form-group am-padding-top">
								<label class="am-u-sm-3 am-form-label">
									apiclient_cert.pem
								</label>
								<div class="am-u-sm-9">
									 <textarea rows="3" name="data[wx][cert_pem]">{$model['wx']['cert_pem']}</textarea>
									<small>退款/提现功能必填：使用文本编辑器打开apiclient_cert.pem文件，将文件的全部内容复制进来</small>
								</div>
							</div>
							<div class="am-form-group">
								<label class="am-u-sm-3 am-form-label">
									apiclient_key.pem
								</label>
								<div class="am-u-sm-9">
									 <textarea rows="3" name="data[wx][key_pem]">{$model['wx']['key_pem']}</textarea>
									<small>退款/提现功能必填：使用文本编辑器打开apiclient_key.pem文件，将文件的全部内容复制进来</small>
								</div>
							</div>
							<div class="widget-head am-cf">
                                <div class="widget-title am-fl">交易分佣设置</div>
                            </div>  
                            <div class="am-form-group">
                                <div class="tips am-margin-bottom-sm am-u-sm-12">
    		                        <div class="pre-error">
    		                            <p> 
    		                                怎样开启分账？设置抽取比例大于0则为开启。<br>
    		                                开启前必须保证旗下商户的支付号开启分账功能，抽取比例比例必须小于商户号中设置的分账比例
    		                            </p>
    		                        </div>
    		                    </div>      
                            </div>           
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label form-require">
                                    分佣总额 <span class="tpl-form-line-small-title">包含配送费</span>
                                </label>
                                <div class="am-u-sm-9">
                                    <label class="am-radio-inline">
                                        <input type="radio" name="data[divide][is_delivery]" value="0" data-am-ucheck
                                            {$model['divide']['is_delivery'] == 0 ? 'checked':''}>
                                        否
                                    </label>
                                    <label class="am-radio-inline">
                                        <input type="radio" name="data[divide][is_delivery]" value="1" data-am-ucheck 
                                        {$model['divide']['is_delivery'] == 1 ? 'checked':''}>
                                        是
                                    </label>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label form-require">分佣模式</label>
                                <div class="am-u-sm-9">
                                    <label class="am-radio-inline">
                                        <input v-model="mode" type="radio" name="data[divide][mode]" value="unify" data-am-ucheck>
                                        统一抽取
                                    </label>
                                    <label class="am-radio-inline">
                                        <input v-model="mode" type="radio" name="data[divide][mode]" value="order" data-am-ucheck>
                                        订单类型
                                    </label>
                                </div>
                            </div>
                            <div v-show="mode == 'unify'" class="am-form-group">
                                <label class="am-u-sm-3 am-form-label form-require">
                                    统一抽取 <span class="tpl-form-line-small-title">比例</span>
                                </label>
                                <div class="am-u-sm-9">
                                    <input type="number" min="0" max="30" class="tpl-form-input" name="data[divide][extract]"
                                    value="{$model['divide']['extract']}" required>
                                    <small>单位百分比，取值0-30，设置为0不收取，设置10为收取订单总额的10%。</small>
                                </div>
                            </div>
                            <div v-show="mode == 'order'">
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label form-require">
                                        堂食抽取 <span class="tpl-form-line-small-title">比例</span>
                                    </label>
                                    <div class="am-u-sm-9">
                                        <input type="number" min="0" max="30" class="tpl-form-input" name="data[divide][order][tang]"
                                        value="{$model['divide']['order']['tang']}" required>
                                        <small>单位百分比，取值0-30，设置为0不收取，设置10为收取订单总额的10%。</small>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label form-require">
                                        外卖抽取 <span class="tpl-form-line-small-title">比例</span>
                                    </label>
                                    <div class="am-u-sm-9">
                                        <input type="number" min="0" max="30" class="tpl-form-input" name="data[divide][order][waimai]"
                                        value="{$model['divide']['order']['waimai']}" required>
                                        <small>单位百分比，取值0-30，设置为0不收取，设置10为收取订单总额的10%。</small>
                                    </div>
                                </div>
                                <div class="am-form-group">
                                    <label class="am-u-sm-3 am-form-label form-require">
                                        自取抽取 <span class="tpl-form-line-small-title">比例</span>
                                    </label>
                                    <div class="am-u-sm-9">
                                        <input type="number" min="0" max="30" class="tpl-form-input" name="data[divide][order][ziqu]"
                                        value="{$model['divide']['order']['ziqu']}" required>
                                        <small>单位百分比，取值0-30，设置为0不收取，设置10为收取订单总额的10%。</small>
                                    </div>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label form-require">
                                    代理抽取 <span class="tpl-form-line-small-title">比例</span>
                                </label>
                                <div class="am-u-sm-9">
                                    <input type="number" min="0" max="100" class="tpl-form-input" name="data[divide][agent_fee]"
                                    value="{$model['divide']['agent_fee']}" required>
                                    <small>
                                        单位百分比，取值0-100，设置为0不收取，设置50为抽取佣金总额的一半，剩余的为平台所有<br>
                                        开启此项必须保证代理配置了收款号
                                    </small>
                                </div>
                            </div>
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">其它设置</div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label form-require">
                                    提现手续费 <span class="tpl-form-line-small-title">模式</span>
                                </label>
                                <div class="am-u-sm-9">
                                    <label class="am-radio-inline">
                                        <input type="radio" name="data[cost][cash_mode]" value="ratio" data-am-ucheck
                                            {$model['cost']['cash_mode'] == 'ratio' ? 'checked':''}>
                                        比例提取
                                    </label>
                                    <label class="am-radio-inline">
                                        <input type="radio" name="data[cost][cash_mode]" value="fixed" data-am-ucheck 
                                        {$model['cost']['cash_mode'] == 'fixed' ? 'checked':''}>
                                        固定金额
                                    </label>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label form-require">
                                    提现手续费 <span class="tpl-form-line-small-title">数值</span>
                                </label>
                                <div class="am-u-sm-9">
                                    <input type="number" min="0" class="tpl-form-input" name="data[cost][cash_fee]"
                                           value="{$model['cost']['cash_fee']}" required>
                                    <small>设置为0则不收取手续费。当设置为10时，如设置为“比例提取”则为提取订单金额的10‰（千分之），如设置为“固定金额”则为10元</small>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-form-label form-require">小程序审核费</label>
                                <div class="am-u-sm-9">
                                    <input type="number" min="0" class="tpl-form-input" name="data[cost][applet_fee]"
                                    value="{$model['cost']['applet_fee']}" required>
                                    <small>设置为0不收取</small>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                    <button type="submit" class="j-submit am-btn am-btn-secondary">提交
                                    </button>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        
        new Vue({
		  el: '#my-form',
		  data: {
			mode: "{$model['divide']['mode']}"
		  }
		});

        $('#my-form').formPost();

    });
</script>
